package com.medusa.aps.business.modules.modeling.mp.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.medusa.aps.business.model.BaseEntity;
import com.medusa.aps.business.modules.modeling.model.output.ProcessRouteDetailVO;
import com.medusa.aps.business.modules.modeling.model.output.ProcessRouteVO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * 工艺路线实体类
 *
 * @author yuxh
 * @since 2023-08-14 17:37:49
 */
@Data
@Accessors(chain = true)
@Schema(description = "工艺路线实体类")
@EqualsAndHashCode(callSuper = true)
public class ProcessRoute extends BaseEntity<ProcessRoute> {
    /**
     * 主键
     */
    @Schema(description = "主键")
    @TableId(type = IdType.AUTO)
    private Integer id;
    /**
     * 工艺路线编码
     */
    @Schema(description = "工艺路线编码")
    private String processRouteCode;
    /**
     * 工艺路线名称
     */
    @Schema(description = "工艺路线名称")
    private String processRouteName;
    /**
     * 工艺路线描述
     */
    @Schema(description = "工艺路线描述")
    private String processRouteDesc;
    /**
     * 创建人
     */
    @Schema(description = "创建人")
    @TableField(fill = FieldFill.INSERT)
    private String creator;
    /**
     * 备注
     */
    @Schema(description = "备注")
    private String remarks;
    /**
     * 物料id
     */
    @Schema(description = "物料id")
    private Long materialId;
    /**
     * 物料编码
     */
    @Schema(description = "物料编码")
    private String materialCode;
    /**
     * 工艺备注 0-->无须编辑,1-->待编辑
     */
    @Schema(description = "工艺备注 0-->无须编辑,1-->待编辑")
    private Boolean processRemark;

    /**
     * 获取主键值
     *
     * @return 主键值
     */
    @Override
    public Serializable pkVal() {
        return this.id;
    }

    public ProcessRouteVO toProcessRouteVO() {
        return new ProcessRouteVO()
                .setId(id)
                .setProcessRouteCode(processRouteCode)
                .setProcessRouteName(processRouteName)
                .setProcessRouteDesc(processRouteDesc)
                .setCreator(creator)
                .setCreateTime(getCreateTime())
                .setProcessRemark(processRemark)
                .setRemarks(remarks)
                .setMaterialCode(materialCode);
    }

    public ProcessRouteDetailVO toProcessRouteDetailVO() {
        return new ProcessRouteDetailVO()
                .setId(id)
                .setProcessRouteCode(processRouteCode)
                .setProcessRouteName(processRouteName)
                .setProcessRouteDesc(processRouteDesc)
                .setMaterialId(materialId)
                .setRemarks(remarks)
                .setProcessRemark(processRemark)
                .setMaterialCode(materialCode);

    }
}

